package zut.wework.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import zut.wework.entity.Result;
import zut.wework.entity.meeting.CreatMeetingModel;
import zut.wework.entity.meeting.InviteModel;
import zut.wework.service.MeetingService;

/**
 * @Classname: MeetingController
 * @Description: 腾讯会议相关接口
 * @Date: 2022/5/8
 * @Created: by ifaxcaeles
 */
@RestController
@RequestMapping("/meeting")
public class MeetingController {

    @Autowired
    MeetingService meetingService;

    @PostMapping("/create")
    public Result createMeeting(@RequestParam String userid, @RequestParam String subject) {
        return meetingService.createMeeting(new CreatMeetingModel(userid, subject));
    }

    @PostMapping("/cancel")
    public Result cancelMeeting(@RequestParam String userid, @RequestParam String meetingid) {
        return meetingService.cancelMeeting(userid, meetingid);
    }

    @GetMapping("/query")
    public Result queryMeetingById(@RequestParam String userid, @RequestParam String meetingid) {
        return meetingService.queryMeeting(userid, meetingid);
    }

    @PutMapping("/invite")
    public Result inviteInvitees(@RequestBody InviteModel inviteModel) {
        return meetingService.inviteInvitees(inviteModel);
    }

    @PostMapping("createAndInvite")
    public Result CreateAndInvite(@RequestBody InviteModel inviteModel) {
        return meetingService.createAndInvite(inviteModel);
    }

    @GetMapping("/query/{userid}/{meetingid}")
    public Result queryMeetingByIdParams(@PathVariable("userid") String userid, @PathVariable("meetingid") String meetingid) {
        return meetingService.queryMeeting(userid, meetingid);
    }

}
